<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>增加公告</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/Swiper/3.4.2/css/swiper.min.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/Swiper/3.4.2/js/swiper.jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>

    <script language="JavaScript" type="text/javascript">
        //判断规则（正则表达式）
        function goto() {
            var notitle = document.getElementById("notitle");
            var notice = document.getElementById("notice");

            if (notitle.value.trim().length < 3) {
                alert("公告标题不少于三个字");
                notitle.focus()
                notitle.value = "";
                return;
            }

            if (notice.value.trim().length < 15) {
                alert("公告内容不少于十五个字");
                notice.focus()
                notice.value = "";
                return;
            }

        }
    </script>

</head>
<body>
<!-- 顶部开始 -->
<div th:replace="common::#topbar"></div>
<!-- 顶部结束 -->
<!-- 中部开始 -->
<div class="wrapper">
    <!-- 左侧菜单开始 -->
    <div th:replace="common::#leftbar"></div>
    <!-- 左侧菜单结束 -->
    <!-- 右侧主体开始 -->
    <div class="page-content">
        <div class="content">
            <!-- 右侧内容框架，更改从这里开始 -->

            <fieldset class="layui-elem-field layui-field-title site-title">
                <legend><a name="default">添加赛事公告</a></legend>
            </fieldset>
            <form class="layui-form" th:action="@{/doadd-notice}" method="post">
                <div class="layui-form-item">
                    <label for="notitle" class="layui-form-label">
                        <span class="x-red"></span>公告标题
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="notitle" name="notitle" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="不少于三个字">
                    </div>


                </div>

                <div class="layui-form-item">
                    <label for="notice" class="layui-form-label">
                        <span class="x-red"></span>公告内容
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="notice" name="notice" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="不少于十五个字">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label for="notime" class="layui-form-label">
                        <span class="x-red"></span>公告时间
                    </label>
                    <div class="layui-input-inline">
                        <input type="datetime-local" id="notime" name="notime" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" placeholder="yyyy-MM-dd">
                    </div>
                </div>


                <div class="layui-form-item">

                    <div class="layui-input-inline">
                        <input type="hidden" id="adid" name="adid" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${user.id}">
                    </div>
                    <div class="layui-input-inline">
                        <input type="hidden" id="cpid" name="cpid" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="${user.cpid}">
                    </div>
                    <div class="layui-input-inline">
                        <input type="hidden" id="notype" name="notype" required="" lay-verify="required"
                               autocomplete="off" class="layui-input" th:value="0">
                    </div>


                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">
                    </label>
                    <input type="submit" name="添加" onclick="goto()" class="layui-btn">
                    <!--                      <button type="submit" name="添加"  class="layui-btn"></button>-->
                </div>
            </form>
            <!-- 右侧内容框架，更改从这里结束 -->
        </div>
    </div>
    <!-- 右侧主体结束 -->
</div>
<!-- 中部结束 -->
<!-- 底部开始 -->
<div th:replace="common::#bottombar"></div>
<!-- 底部结束 -->
<!-- 背景切换开始 -->
<div th:replace="common::#backbar"></div>
<!-- 背景切换结束 -->
</body>
</html>